import { Controller } from "../../mvc/core/Controller";
import { IRankingController } from "./interfaces/IRankingController";
import { DataEvent } from "../events/DataEvent";
import { GameProxy } from "../mvc/GameProxy";
import { IRankingModule } from "../../../modules/interfaces/IRankingModule";
import { SSeqSpecialActiveInfo } from "../../../Message/Public/SSeqSpecialActiveInfo";
import { MessageBlock } from "../../../Framework/MQ/MessageBlock";
import { SActiveToClient } from "../../../Message/Public/SActiveToClient";
import { ClockManager } from "../manager/ClockManager";
import { InterFlowerWindow } from "../view/range/interFlower/InterFlowerWindow";
import { InterFlowerBtnIcon } from "../view/range/interFlower/InterFlowerBtnIcon";
import { PlayerEquipPanel } from "../view/range/PlayerEquipPanel";
import { IView } from "../../mvc/interfaces/IView";
import { RankingModule } from "../../../modules/RankingModule";
import { WindowEvent } from "../../component/window/WindowEvent";
import { NetDispatcher } from "../../mvc/core/NetDispatcher";
import { EPublicCommand } from "../../../Message/Command/EPublicCommand";
import { Dispatcher } from "../../mvc/core/Dispatcher";
import { EventName } from "../mvc/EventName";
import { ServerCommand } from "../mvc/ServerCommand";
import { EGateCommand } from "../../../Message/Command/EGateCommand";
import { EToplistType } from "../../../Message/Public/EToplistType";
import { SEntityId } from "../../../Message/Public/SEntityId";
import { MsgManager } from "../manager/MsgManager";
import { Language } from "../../../extend/language/Language";
import { SLookupPlayerReply } from "../../../Message/Game/SLookupPlayerReply";
import { SPlayerItemUpdate } from "../../../Message/Game/SPlayerItemUpdate";
import { ItemData } from "../resource/info/ItemData";
import { PlayerEqStrengthInfo } from "../view/player/equip/PlayerEqStrengthInfo";
import { Global } from "../../../com/gengine/global/Global";
import { SErrorMsgCrossToplist } from "../../../Message/Public/SErrorMsgCrossToplist";
import { SVotePlayer } from "../../../Message/Game/SVotePlayer";
type int = number;
//class RankingController
    
    export  class RankingController extends Controller implements IRankingController
    {
       

        /* internal  */onGetMyToplistHandler(arg1: DataEvent): void
        {
            GameProxy.rankingProxy.getMyToplistRank();
            return;
        }

        /* internal  */onGetMyToplistSuccessHandler(arg1: DataEvent): void
        {
            var loc1=arg1.data as Map<any, any> /* flash.utils.Dictionary */;
            cache.ranking.myToplistMap = loc1;
            return;
        }

        /* internal  */onRankGetEquipTipsInfoHandler(arg1: DataEvent): void
        {
            var loc1=arg1.data as string;
            GameProxy.rankingProxy.getEquipScoreInfo([loc1], this.onGetEquipTipsInfoSuccessHandler);
            return;
        }

        /* internal  */onGetEquipTipsInfoSuccessHandler(arg1: Map<any, any> /* flash.utils.Dictionary */): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=false;
            var loc4=0;
            var loc5=null;
            var loc6=0;
            var loc7=arg1;
            for (loc1 in loc7) 
            {
                loc2 = arg1[loc1];
                loc3 = loc2.exist;
                loc4 = loc2.itemCode;
                loc5 = loc2.jsStr;
                if (!(this._ranking && loc3)) 
                {
                    continue;
                }
                this._ranking.setEquipTipsInfo(loc4, loc5);
            }
            return;
        }

        /* internal  */onRankSelectedAssignTypeHandler(arg1: DataEvent): void
        {
            var loc1=arg1.data;
            if (!this._ranking || this._ranking && this._ranking.isHide) 
            {
                view.show();
            }
            (view as IRankingModule).selectedAssignType(loc1);
            return;
        }

        /* internal  */onInterFlowerWindowOpenHandler(arg1: DataEvent): void
        {
            if (this.interFlowerWindow.isHide) 
            {
                this.interFlowerWindow.show(300, 70);
                if (this._charmActive && cache.active.isActiveInEffect(this._charmActive.code)) 
                {
                    GameProxy.daily.getCharmActivityRewardConfig();
                }
            }
            else 
            {
                this.interFlowerWindow.hide();
            }
            return;
        }

        /* internal  */onVotePlayerHandler(arg1: DataEvent): void
        {
            var loc1=(arg1.data as Object).type;
            var loc2=(arg1.data as Object).playerId;
            GameProxy.rankingProxy.votePlayer(loc1, 0, loc2);
            return;
        }

        /* internal  */onSpecialFloRewardGetHandler(arg1: DataEvent): void
        {
            GameProxy.daily.getSpecialFlowerReward();
            return;
        }

        /* internal  */onSpecialFloRewardGetReqHandler(arg1: DataEvent): void
        {
            var loc1=arg1.data as SSeqSpecialActiveInfo;
            cache.ranking.specialFlowerRewards = loc1;
            if (this._interFlowerWindow) 
            {
                this._interFlowerWindow.updateReward();
            }
            return;
        }

        /* internal  */onCharmActivityRewardGetConfigHandler(arg1: DataEvent): void
        {
            GameProxy.daily.getCharmActivityRewardConfig();
            return;
        }

        /* internal  */onCharmActivityRewardGetConfigSuccessHandler(arg1: DataEvent): void
        {
            var loc1=arg1.data;
            cache.ranking.dailyCharm = loc1.dailyCharm as int;
            cache.ranking.charmRewardInfo = loc1.rewardInfo as Array<any>;
            if (this._interFlowerWindow) 
            {
                this._interFlowerWindow.updateCharmReward();
            }
            return;
        }

        /* internal  */onToplistCrossUpdateHandler(arg1: MessageBlock): void
        {
            cache.ranking.setIsUpdate();
            if (!(this._ranking == null) && !this._ranking.isHide) 
            {
                GameProxy.rankingProxy.getRankingData(this._rankingType);
            }
            return;
        }

        /* internal  */onRankInterFlowerActiveHandler(arg1: SActiveToClient): void
        {
            this._activeToClient = arg1;
            var loc1=cache.active.isActiveInEffect(this._activeToClient.code);
            if (loc1) 
            {
                this.interFlowerBtnIcon.show();
                ClockManager.instance.addDateCall(arg1.endDt, this.removeInterFlowerActive);
            }
            return;
        }

        /* internal  */onActiveCrossFlowerCharmHandler(arg1: SActiveToClient): void
        {
            this._charmActive = arg1;
            var loc1=cache.active.isActiveInEffect(this._charmActive.code);
            if (loc1) 
            {
                ClockManager.instance.addDateCall(arg1.endDt, this.removeInterFlowerActive);
            }
            return;
        }

        public get interFlowerWindow(): InterFlowerWindow
        {
            var loc1=false;
            if (this._interFlowerWindow == null) 
            {
                this._interFlowerWindow = new InterFlowerWindow();
                loc1 = false;
                if (this._charmActive) 
                {
                    loc1 = cache.active.isActiveInEffect(this._charmActive.code);
                }
                if (loc1) 
                {
                    this._interFlowerWindow.setActiveType(this._charmActive.code);
                }
                else 
                {
                    this._interFlowerWindow.setActiveType(this._activeToClient.code);
                }
            }
            return this._interFlowerWindow;
        }

        public get interFlowerBtnIcon(): InterFlowerBtnIcon
        {
            if (this._interFlowerBtnIcon == null) 
            {
                this._interFlowerBtnIcon = InterFlowerBtnIcon.instance;
            }
            return this._interFlowerBtnIcon;
        }

        /* internal  */removeInterFlowerActive(): void
        {
            this.interFlowerBtnIcon.hide();
            return;
        }

        public get playerEquipPanel(): PlayerEquipPanel
        {
            if (this._playerEquipPanel == null) 
            {
                this._playerEquipPanel = new PlayerEquipPanel(true);
                this._playerEquipPanel.closeBtn.visible = true;
            }
            return this._playerEquipPanel;
        }

        protected /* override */ initView(): IView
        {
            if (this._ranking == null) 
            {
                this._ranking = new RankingModule();
                this._ranking.addEventListener(WindowEvent.SHOW, this.onWindowShowHandler);
            }
            this._fromPlayerId = cache.role.entityInfo.entityId;
            this._playerName = cache.role.playerInfo.name;
            if (cache.guild.myGuildInfo != null) 
            {
                this._guildName = cache.guild.myGuildInfo.guildName;
            }
            else 
            {
                this._guildName = "";
            }
            NetDispatcher.addCmdListener(EPublicCommand._ECmdPublicToplistUpdate, this.onToplistUpdateHandler);
            return this._ranking;
        }

        protected /* override */ initServer(): void
        {
            Dispatcher.addEventListener(EventName.RankingTypeChange, this.onRankTypeChangeHandler);
            Dispatcher.addEventListener(EventName.RankingPageChange, this.onPageChangeHandler);
            Dispatcher.addEventListener(EventName.RankingCampChange, this.onRankCampChangeHandler);
            Dispatcher.addEventListener(EventName.RankingCareerChange, this.onRankCareerChangeHandler);
            Dispatcher.addEventListener(EventName.RankingSexChange, this.onRankSexChangeHandler);
            Dispatcher.addEventListener(EventName.RankingQueryByName, this.onQueryByNameHandler);
            Dispatcher.addEventListener(EventName.LookUpTargetEquip, this.onLookUpEquipHandler);
            Dispatcher.addEventListener(EventName.VotePlayer, this.onVotePlayerHandler);
            Dispatcher.addEventListener(EventName.GuildSearchSuccess, this.onGuildSearchSuccessHandler);
            Dispatcher.addEventListener(EventName.RankingGetMyRank, this.onRankingGetMyRankHandler);
            Dispatcher.addEventListener(EventName.RankGetVoteCountSuccess, this.onGetVoteCountSuccessHandler);
            Dispatcher.addEventListener(EventName.RankGetMyToplist, this.onGetMyToplistHandler);
            Dispatcher.addEventListener(EventName.RankGetMyToplistSuccess, this.onGetMyToplistSuccessHandler);
            Dispatcher.addEventListener(EventName.RankGetEquipTipsInfos, this.onRankGetEquipTipsInfoHandler);
            Dispatcher.addEventListener(EventName.RankSelectedAssignType, this.onRankSelectedAssignTypeHandler);
            Dispatcher.addEventListener(EventName.RankInterFlowerWindowOpen, this.onInterFlowerWindowOpenHandler);
            Dispatcher.addEventListener(EventName.SpecialFloRewardGet, this.onSpecialFloRewardGetHandler);
            Dispatcher.addEventListener(EventName.SpecialFloRewardGetReq, this.onSpecialFloRewardGetReqHandler);
            Dispatcher.addEventListener(EventName.CharmActivityRewardGetConfig, this.onCharmActivityRewardGetConfigHandler);
            Dispatcher.addEventListener(EventName.CharmActivityRewardGetConfigSuccess, this.onCharmActivityRewardGetConfigSuccessHandler);
            NetDispatcher.addCmdListener(EPublicCommand._ECmdPublicToplistCrossUpdate, this.onToplistCrossUpdateHandler);
            NetDispatcher.addCmdListener(ServerCommand.GetRankingDataSuccess, this.onGetDataSuccessHandler);
            NetDispatcher.addCmdListener(ServerCommand.SearchPlayerResult, this.onSearchPlayer);
            NetDispatcher.addCmdListener(ServerCommand.SearchPlayerNoPlayer, this.onSearchPlayerNoHandler);
            NetDispatcher.addCmdListener(ServerCommand.PlayerInfoReply, this.onPlayerInfoMsg);
            NetDispatcher.addCmdListener(ServerCommand.PlayerNotOnline, this.onPlayerNotOnlineHandler);
            NetDispatcher.addCmdListener(EPublicCommand._ECmdPublicVotePlayerUpdate, this.onVotePlayerUpdateHandler);
            NetDispatcher.addCmdListener(EGateCommand._ECmdGateLookUpPlayerCrossToplistErrorMsg, this.onLookUpPlayerCrossToplistErrorHandler);
            NetDispatcher.addCmdListener(ServerCommand.RankInterFlowerActive, this.onRankInterFlowerActiveHandler);
            NetDispatcher.addCmdListener(ServerCommand.ActiveCrossFlowerCharm, this.onActiveCrossFlowerCharmHandler);
            Dispatcher.addEventListener(EventName.NPCStatuePlayerReq, this.onNPCStatuePlayerReqHandler);
            return;
        }

        /* internal  */onRankTypeChangeHandler(arg1: DataEvent): void
        {
            var loc1=arg1.data as int;
            if (loc1 == EToplistType._EToplistTypeArenaMark && cache.wrestle.isCross()) 
            {
                loc1 = EToplistType._EToplistTypeWrestleMark;
            }
            if (!(this._ranking == null) && !(loc1 == EToplistType._EToplistTypeLoadDays)) 
            {
                this._rankingType = loc1;
                this._ranking.resetEquipData();
                this._ranking.resetSelectedPanel();
            }
            this.getCurRankList(loc1);
            return;
        }

        /* internal  */onWindowShowHandler(arg1: WindowEvent): void
        {
            this.getCurRankList(this._rankingType);
            if (cache.ranking.voteCount == -1) 
            {
                GameProxy.rankingProxy.getRestVoteCount();
            }
            return;
        }

        /* internal  */getCurRankList(arg1: int): void
        {
            var loc1=null;
            var loc2=0;
            cache.ranking.rankingType = arg1;
            if (cache.ranking.isHaveList(arg1) && !cache.ranking.getIsUpdate(arg1)) 
            {
                if (arg1 == EToplistType._EToplistTypeFlowerDailyProtect + EToplistType._EToplistTypeCrossBase || arg1 == EToplistType._EToplistTypeFlowerDaily + EToplistType._EToplistTypeCrossBase) 
                {
                    this.interFlowerWindow.updateData(cache.ranking.getData(arg1));
                    return;
                }
                loc1 = cache.ranking.getDataByPage(arg1, 1, this._rankingCamp, this._rankingCareer, this._rankingSex);
                loc2 = cache.ranking.selfRank(arg1);
                if (!(this._ranking == null) && !(arg1 == EToplistType._EToplistTypeLoadDays)) 
                {
                    this._ranking.setData(loc1, arg1);
                    this._ranking.setMaxPage(cache.ranking.curMaxPage);
                }
                Dispatcher.dispatchEvent(new DataEvent(EventName.RankGetDataSuccess, arg1));
            }
            else 
            {
                GameProxy.rankingProxy.getRankingData(arg1);
            }
            return;
        }

        /* internal  */onPageChangeHandler(arg1: DataEvent): void
        {
            var loc1=arg1.data as int;
            var loc2=cache.ranking.getDataByPage(this._rankingType, loc1, this._rankingCamp, this._rankingCareer, this._rankingSex);
            if (!(this._ranking == null) && !(this._rankingType == EToplistType._EToplistTypeLoadDays)) 
            {
                this._ranking.setData(loc2, this._rankingType, loc1);
            }
            return;
        }

        /* internal  */onRankCampChangeHandler(arg1: DataEvent): void
        {
            this._rankingCamp = arg1.data as int;
            var loc1=cache.ranking.getDataByPage(this._rankingType, 1, this._rankingCamp, this._rankingCareer, this._rankingSex);
            if (!(this._ranking == null) && !(this._rankingType == EToplistType._EToplistTypeLoadDays)) 
            {
                this._ranking.setData(loc1, this._rankingType, 1);
                this._ranking.setMaxPage(cache.ranking.curMaxPage);
            }
            return;
        }

        /* internal  */onRankCareerChangeHandler(arg1: DataEvent): void
        {
            this._rankingCareer = arg1.data as int;
            var loc1=cache.ranking.getDataByPage(this._rankingType, 1, this._rankingCamp, this._rankingCareer, this._rankingSex);
            if (!(this._ranking == null) && !(this._rankingType == EToplistType._EToplistTypeLoadDays)) 
            {
                this._ranking.setData(loc1, this._rankingType, 1);
                this._ranking.setMaxPage(cache.ranking.curMaxPage);
            }
            return;
        }

        /* internal  */onRankSexChangeHandler(arg1: DataEvent): void
        {
            this._rankingSex = arg1.data as int;
            var loc1=cache.ranking.getDataByPage(this._rankingType, 1, this._rankingCamp, this._rankingCareer, this._rankingSex);
            if (!(this._ranking == null) && !(this._rankingType == EToplistType._EToplistTypeLoadDays)) 
            {
                this._ranking.setData(loc1, this._rankingType, 1);
                this._ranking.setMaxPage(cache.ranking.curMaxPage);
            }
            return;
        }

        /* internal  */onQueryByNameHandler(arg1: DataEvent): void
        {
            var loc3=0;
            var loc4=0;
            var loc5=null;
            var loc6=0;
            if (this._rankingType == EToplistType._EToplistTypePetTalent || this._rankingType == EToplistType._EToplistTypePetGrowth || this._rankingType == EToplistType._EToplistTypePetSpirit || this._rankingType == EToplistType._EToplistTypeCopyMagicTower || this._rankingType == EToplistType._EToplistTypeWeaponScore || this._rankingType == EToplistType._EToplistTypeJewelryScore || this._rankingType == EToplistType._EToplistTypeArmorScore || this._rankingType == EToplistType._EToplistTypeAmuletLevel || this._rankingType == EToplistType._EToplistTypeAmuletClothesScore || this._rankingType == EToplistType._EToplistTypeAmuletHelmetScore || this._rankingType == EToplistType._EToplistTypeAmuletPantsScore || this._rankingType == EToplistType._EToplistTypeAmuletShoulderScore || this._rankingType == EToplistType._EToplistTypeAmuletWeaponScore) 
            {
                return;
            }
            var loc1=arg1.data as string;
            var loc2=cache.ranking.isInRankingByName(this._rankingType, loc1);
            if (loc2 == 0) 
            {
                if ((loc6 = this._rankingType / 100) == 2) 
                {
                    GameProxy.guildProxy.searchGuilds(0, loc1);
                }
                else 
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.FriendSearchPlayer, loc1));
                }
                this._isSearch = true;
            }
            else 
            {
                if ((loc3 = loc2 % 10) == 0) 
                {
                    loc4 = loc2 / 10;
                }
                else 
                {
                    loc4 = loc2 / 10 + 1;
                }
                loc5 = cache.ranking.getDataByPage(this._rankingType, loc4);
                if (!(this._ranking == null) && !(this._rankingType == EToplistType._EToplistTypeLoadDays)) 
                {
                    this._ranking.setData(loc5, this._rankingType, loc4, false);
                    this._ranking.showTargetPalyer(this._rankingType, loc2);
                }
            }
            return;
        }

        /* internal  */onLookUpEquipHandler(arg1: DataEvent): void
        {
            var loc1=arg1.data as SEntityId;
            this.lookUpEquip(loc1);
            if (this._ranking && !this._ranking.isHide && !(this._rankingType == EToplistType._EToplistTypeLoadDays)) 
            {
                this._ranking.resetEquipData();
            }
            return;
        }

        /* internal  */lookUpEquip(arg1: SEntityId): void
        {
            this._isLookUp = true;
            this._toPlayerId = arg1.id;
            GameProxy.playerInfoProxy.lookupRequest_async(this._fromPlayerId, arg1, null, false);
            return;
        }

        /* internal  */onNPCStatuePlayerReqHandler(arg1: DataEvent): void
        {
            this._isNpcStatueLookup = true;
            var loc1=cache.dialog.npcInfo.statuePlayer.entityId;
            this._toNpcId = loc1.id;
            GameProxy.playerInfoProxy.lookupRequestCrossToplist(cache.role.entityInfo.entityId, loc1, false, false);
            return;
        }

        /* internal  */onGetDataSuccessHandler(arg1: Object): void
        {
            var loc1=arg1.rankingList as Array<any>;
            var loc2=arg1.type;
            cache.ranking.setData(loc1, loc2);
            cache.ranking.severdId = arg1.serverId;
            cache.ranking.setIsUpdateByType(loc2, false);
            this._serverId = arg1.serverId;
            if (loc2 == EToplistType._EToplistTypeFlowerDailyProtect + EToplistType._EToplistTypeCrossBase || loc2 == EToplistType._EToplistTypeFlowerDaily + EToplistType._EToplistTypeCrossBase) 
            {
                this.interFlowerWindow.updateData(cache.ranking.getData(loc2));
                return;
            }
            var loc3=cache.ranking.getDataByPage(loc2, 1);
            if (!(this._ranking == null) && !(loc2 == EToplistType._EToplistTypeLoadDays)) 
            {
                this._ranking.setData(loc3, loc2);
                this._ranking.setMaxPage(cache.ranking.curMaxPage);
            }
            Dispatcher.dispatchEvent(new DataEvent(EventName.RankGetDataSuccess, loc2));
            return;
        }

        /* internal  */onSearchPlayer(arg1: Object): void
        {
            var loc1=false;
            if (this._isSearch) 
            {
                loc1 = arg1["isFind"];
                if (loc1) 
                {
                    MsgManager.showRollTipsMsg(Language.getString(32000));
                }
                else 
                {
                    MsgManager.showRollTipsMsg(Language.getString(32001));
                }
                this._isSearch = false;
            }
            return;
        }

        /* internal  */onSearchPlayerNoHandler(arg1: Object): void
        {
            if (this._isSearch) 
            {
                MsgManager.showRollTipsMsg(Language.getString(32001));
                this._isSearch = false;
            }
            return;
        }

        /* internal  */onGuildSearchSuccessHandler(arg1: DataEvent): void
        {
            var loc1=null;
            if (this._isSearch) 
            {
                loc1 = arg1.data as Array<any>;
                if (loc1.length > 0) 
                {
                    MsgManager.showRollTipsMsg(Language.getString(32002));
                }
                else 
                {
                    MsgManager.showRollTipsMsg(Language.getString(32003));
                }
                this._isSearch = false;
            }
            return;
        }

        /* internal  */onRankingGetMyRankHandler(arg1: DataEvent): void
        {
            var loc2=0;
            var loc3=0;
            var loc4=null;
            if (this._rankingType == EToplistType._EToplistTypePetTalent || this._rankingType == EToplistType._EToplistTypePetGrowth || this._rankingType == EToplistType._EToplistTypePetSpirit || this._rankingType == EToplistType._EToplistTypeCopyMagicTower || this._rankingType == EToplistType._EToplistTypeWeaponScore || this._rankingType == EToplistType._EToplistTypeJewelryScore || this._rankingType == EToplistType._EToplistTypeArmorScore) 
            {
                return;
            }
            var loc1=cache.ranking.selfRank(this._rankingType);
            if (loc1 != 0) 
            {
                loc2 = loc1 % 10;
                if (loc2 == 0) 
                {
                    loc3 = loc1 / 10;
                }
                else 
                {
                    loc3 = loc1 / 10 + 1;
                }
                loc4 = cache.ranking.getDataByPage(this._rankingType, loc3);
                if (!(this._ranking == null) && !(this._rankingType == EToplistType._EToplistTypeLoadDays)) 
                {
                    this._ranking.setData(loc4, this._rankingType, loc3, false);
                    this._ranking.showTargetPalyer(this._rankingType, loc1);
                }
            }
            else 
            {
                MsgManager.showRollTipsMsg(Language.getString(32004));
            }
            return;
        }

        /* internal  */onPlayerInfoMsg(arg1: Object): void
        {
            var loc10=null;
            var loc11=null;
            var loc1=arg1 as SLookupPlayerReply;
            var loc2=loc1.miniPlayer.entityId.id;
            var loc3;
            var loc4=(loc3 = loc1.playerItemUpdates).length;
            var loc5=[];
            var loc6=0;
            loc6 = 0;
            while (loc6 < 14) 
            {
                loc5.push(null);
                ++loc6;
            }
            loc6 = 0;
            while (loc6 < loc4) 
            {
                if ((loc10 = loc3[loc6] as SPlayerItemUpdate).playerItem) 
                {
                    loc11 = new ItemData(loc10.playerItem);
                    loc5[(loc10.posIndex - 1)] = loc11;
                }
                ++loc6;
            }
            var loc7=loc1.beAdored;
            var loc8=loc1.beDespised;
            var loc9={"equipArr": loc5, "adoreNum": loc7, "despiseNum": loc8};
            if (this._isLookUp) 
            {
                this._isLookUp = false;
                if (!(this._ranking == null) && this._toPlayerId == loc2) 
                {
                    PlayerEqStrengthInfo.otherEquipments = loc5;
                    PlayerEqStrengthInfo.otherJewelTarget = loc1.jewelTarget;
                    this._ranking.setEquipData(loc9, loc1);
                }
            }
            if (this._isNpcStatueLookup) 
            {
                this._isNpcStatueLookup = false;
                if (this._toNpcId == loc2) 
                {
                    PlayerEqStrengthInfo.otherEquipments = loc5;
                    PlayerEqStrengthInfo.otherJewelTarget = loc1.jewelTarget;
                    this.playerEquipPanel.setData(loc9, loc1);
                    this.playerEquipPanel.show((Global.stage.stageWidth - this.playerEquipPanel.width) / 2, (Global.stage.stageHeight - this.playerEquipPanel.height) / 2);
                    if (loc1.miniPlayer.entityId.typeEx == cache.role.entityInfo.entityId.typeEx && loc1.miniPlayer.entityId.typeEx2 == cache.role.entityInfo.entityId.typeEx2) 
                    {
                        this.playerEquipPanel.setVoteBtn(true);
                        if (cache.ranking.voteCount == -1) 
                        {
                            GameProxy.rankingProxy.getRestVoteCount();
                        }
                    }
                    else 
                    {
                        this.playerEquipPanel.setVoteBtn(false);
                    }
                }
            }
            return;
        }

        /* internal  */onPlayerNotOnlineHandler(arg1: Object): void
        {
            var loc1=0;
            if (this._isLookUp) 
            {
                this._isLookUp = false;
                loc1 = arg1 as int;
                if (!(this._ranking == null) && this._toPlayerId == loc1 && !(this._rankingType == EToplistType._EToplistTypeLoadDays)) 
                {
                    this._ranking.setNotOnline(loc1);
                }
            }
            return;
        }

        /* internal  */onLookUpPlayerCrossToplistErrorHandler(arg1: MessageBlock): void
        {
            var loc1=null;
            if (this._isNpcStatueLookup) 
            {
                this._isNpcStatueLookup = false;
                loc1 = arg1.messageBase as SErrorMsgCrossToplist;
                if (this._toNpcId == loc1.fromEntityId.id) 
                {
                    this.playerEquipPanel.show((Global.stage.stageWidth - this.playerEquipPanel.width) / 2, (Global.stage.stageHeight - this.playerEquipPanel.height) / 2);
                    this.playerEquipPanel.setNotOnline(true);
                    this.playerEquipPanel.setVoteBtn(false);
                }
            }
            return;
        }

        /* internal  */onToplistUpdateHandler(arg1: MessageBlock): void
        {
            cache.ranking.setIsUpdate();
            if (!(this._ranking == null) && !this._ranking.isHide) 
            {
                GameProxy.rankingProxy.getRankingData(this._rankingType);
            }
            GameProxy.rankingProxy.getMyToplistRank();
            return;
        }

        /* internal  */onVotePlayerUpdateHandler(arg1: MessageBlock): void
        {
            var loc1=arg1.messageBase as SVotePlayer;
            if (this._ranking && !this._ranking.isHide) 
            {
                this._ranking.votePlayerSuccess(loc1);
            }
            if (this._playerEquipPanel && !this._playerEquipPanel.isHide) 
            {
                this.playerEquipPanel.voteSuccess(loc1);
            }
            return;
        }

        /* internal  */onGetVoteCountSuccessHandler(arg1: DataEvent): void
        {
            var loc1=arg1.data as int;
            cache.ranking.voteCount = Math.abs(loc1);
            if (this._ranking != null) 
            {
                this._ranking.showVoteCount();
            }
            return;
        }

        private /* var */_ranking: IRankingModule;

        private /* var */_rankingType: int;

        private /* var */_rankingCamp: int=0;

        private /* var */_rankingCareer: int=-1;

        private /* var */_rankingSex: int=-1;

        private /* var */_playerName: string;

        private /* var */_isLookUp: Boolean=false;

        private /* var */_fromPlayerId: SEntityId;

        private /* var */_serverId: int;

        private /* var */_guildName: string;

        private /* var */_toPlayerId: int;

        private /* var */_interFlowerWindow: InterFlowerWindow;

        private /* var */_interFlowerBtnIcon: InterFlowerBtnIcon;

        private /* var */_playerEquipPanel: PlayerEquipPanel;

        private /* var */_isSearch: Boolean=false;

        private /* var */_charmActive: SActiveToClient;

        private /* var */_isNpcStatueLookup: Boolean=false;

        private /* var */_toNpcId: int;

        private /* var */_activeToClient: SActiveToClient;
    }
